package com.feinno.urcs.group.api;

import com.feinno.urcs.group.entity.GroupIndex;
import com.feinno.urcs.types.MobileNo;
import org.helium.framework.annotations.ServiceInterface;

import java.sql.SQLException;

/**
 * GGRPDB
 * GGRP_GroupIndex
 * Created by Lei Gao on 4/22/15.
 */
@ServiceInterface(id="group:GroupIndexService")
public interface GroupIndexService {
	/**
	 * 1. select * from GRP_GroupIndex where groupUri = @groupUri
	 *
	 * @param groupId
	 * @return
	 */
	GroupIndex getGroupById(int groupId) throws Exception;

	/**
	 * @param groupUri
	 * @return
	 * @throws SQLException
	 */
	GroupIndex getGroupByUri(String groupUri) throws Exception;

	/**
	 * 1. select * from GRP_GroupIndex where ConversationId = @conversationId
	 *
	 * @param conversationId
	 * @return
	 */
	GroupIndex getGroupByConversationId(String conversationId) throws Exception;

	/**
	 * TODO: domain? setting?
	 * generate group id & uri & logicalPool!!
	 * insert into GRP_GroupIndex (conversationId, ...);
	 * select * from GRP_GroupIndex where ConversationId = @conversationId
	 * superAdmin     飞信测创建群必填字段, 格式:sip:560095609@femoo.amigo.bjmcc.net;p=4001
	 * @param conversationId
	 */
	GroupIndex createGroup(String conversationId, String subject,MobileNo adminMobileNo) throws Exception;

	/**
	 * @param groupId
	 * @return
	 */
	boolean deleteGroup(int groupId) throws Exception;
}
